import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:scanner/main/home/wj_home_logic.dart';
import 'package:scanner/page_routes.dart';
import 'package:scanner/widgets/custom_container.dart';

class WJHomePage extends GetView<WJHomeLogic> {
  const WJHomePage({super.key});

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return SafeArea(
      child: Column(
        children: [
          Row(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              WJCustomContainer(onTap: (){
                Get.toNamed(WJAppRoutes.scanner);
              }, width: 165.w, height: 215.w, color: Colors.blue),
              SizedBox(width: 15.w),
              Column(
                children: [
                  WJCustomContainer(width: 165.w, height: 100.w, color: Colors.blue),
                  SizedBox(height: 15.w),
                  WJCustomContainer(width: 165.w, height: 100.w, color: Colors.blue),
                ],
              ),
            ],
          ),

          SizedBox(height: 10.w),

          GridView.count(
            crossAxisCount: 4,        // 每行4个item
            mainAxisSpacing: 10,     // 垂直间距
            crossAxisSpacing: 10,    // 水平间距
            shrinkWrap: true,        // 适配内容高度
            physics: NeverScrollableScrollPhysics(), // 禁止滚动
            children: List.generate(8, (index) {
              return Container(
                color: Colors.blue,
                alignment: Alignment.center,
                child: Text(
                  'Item $index',
                  style: TextStyle(color: Colors.white),
                ),
              );
            }),
          ).paddingOnly(left: 15.w,right: 15.w)
        ],
      ),
    );
  }
}
